﻿using XFControls.Utils;
using XFControls.XFPanels.XFPanelItems;
using System.Drawing;

namespace XFSenseUI.XFItems
{
    public class SenseItemDivider : SenseItemBase
    {
        public string Text { get; set; }

        private int _height = 32;

        public SenseItemDivider()
        {
            Style = new XFItemStyle
                    {
                        BackgroundImageString = "topic-spacer",
                        TextFont = new Font(FontFamily.GenericMonospace, 8, FontStyle.Bold),
                        TextColor = Color.FromArgb(239, 235, 239),
                        Padding = 5,
                        PaddingBottom = 12,
                        PaddingLeft = 10,
                        PaddingRight = 16
                    };
        }

        public override int GetHeight()
        {
            //if (Buffer == null)
            //    Buffer = XFBitmapFactory.GetBitmap(GetWidth(false), _height);

            return _height;
        }

        public override void ItemPaint(Graphics g, int x, int y)
        {
            base.ItemPaint(g, x, y);
            using (SolidBrush b = new SolidBrush(Style.TextColor))
                g.DrawString(Text, Style.TextFont, b, x + Style.PaddingLeft, y + Style.PaddingTop);
        }
    }
}
